clear all;
load trainingdata;
load testdata;

% Normalizing the feature
data=normalize_feature(data);
testdata=normalize_feature(testdata);

% Shuffle data
order = randperm(size(data,1));
data = data(order,:);

beta=sgd(data,0.1,0.1);

% Find best settings
indices = crossvalind('Kfold',size(data,1),5);
options = optimset('MaxFunEvals',10,'PlotFcns',@optimplotfval);
bestsettings=fminsearch(@(settings) crossvalrun(data,settings,indices),[.8605 0.1],...
    options);


%test(testdata,beta)
